{extend name="admin@index_layout"/}
{block name="main"}
<style type="text/css">
    .childrenBody {
        background: #fff;
    }
</style>

<div class="layui-card">
    <div class="layui-card-header">接送服务</div>
    <div class="layui-card-body">
        <table class="layui-hide" id="currentTable" lay-filter="currentTable"></table>
    </div>
</div>

<script type="text/html" id="picTpl">
    <img style="max-width:80px; max-height:30px;" src="{{d.icon_img}}" data-image="{{d.name}}">
</script>
<script type="text/html" id="picTpl2">

    <img style="max-width:80px; max-height:30px;" src="{{d.bc_img}}" data-image="{{d.name}}">

</script>

<script type="text/html" id="statusTypeTpl">
    <input type="checkbox" name="status" data-href='{:url("setstate")}?id={{d.id}}' value="{{d.id}}" lay-skin="switch"
           lay-text="通过|待审核" lay-filter="switchStatus" {{ d.status==1 ? 'checked' : '' }}>
</script>

<script type="text/html" id="barTool">
<!--    <a class="layui-btn layui-btn-xs layui-btn-normal" data-open='{:url("areap")}?id={{ d.id }}' data-title="区域价格设置"-->
<!--       data-full="true">区域价格设置</a>-->

    <a class="layui-btn layui-btn-xs" data-open='{:url("edit")}?id={{ d.id }}' data-title="编辑内容"
       data-full="true">编辑</a>

<!--    <a href='{:url("del")}?ids={{ d.id }}'-->
<!--       class="layui-btn layui-btn-danger layui-btn-xs layui-tr-del">删除</a>-->
</script>


{/block}
{block name="script"}
<script>
    layui.use(['table', 'yznTable'], function () {
        // var table = layui.table,
        //     $ = layui.$,
        //     form = layui.form,
        //     table = layui.table,
        var table = layui.yznTable;

        var init = {
            table_elem: '#currentTable',
            add_url: "{:url('add',['catid'=>$catid])}",
            delete_url: "{:url('del',['catid'=>$catid])}",
            modify_url: '{:url("listorder",["catid"=>$catid])}',
        };
        var cate_list = {:json_encode($server_cate)};
        table.render({
            init: init,
            id: 'currentTable',
            elem: '#currentTable',
            url: '{:url("index")}',
            search:false,
            // searchFormTpl:,
            toolbar: ['refresh',
                // [{
                //     text: '添加',
                //     url: init.add_url,
                //     method: 'open',
                //     icon: 'iconfont icon-add',
                //     class: 'layui-btn layui-btn-normal layui-btn-sm',
                //     extend: 'data-full="true"',
                // }],
            ],
            cols: [
                [
                    {field: 'id', width: '5%', align: "center", title: 'ID', search: false},
                    // {field: 'cate_name', align: "center", width: '10%', title: '分类', selectList: cate_list},
                    {field: 'name', align: "center", width: '16%', title: '名称', search: true},
                    {field: 'icon_img', align: "center", width: '10%', title: '图标', templet: '#picTpl', search: false},
                    {field: 'bc_img', align: "center", width: '10%', title: '背景', templet: '#picTpl2', search: false},
                    {
                        field: 'status',
                        width: '10%',
                        align: "center",
                        title: '状态',
                        templet: '#statusTypeTpl',
                        unresize: true,
                        selectList: {0: '隐藏', 1: '显示'}
                    },
                    {field: 'price', align: "center", width: '10%', title: '价格', search: false},
                    {field: 'sort', align: "center", width: '10%', title: '排序', search: false},
                    {fixed: 'right', align: "center", width: '30%', title: '操作', toolbar: '#barTool'}
                ]
            ],
            page: {}
        });
        yznTable.bindevent();
        selectElement2 = document.getElementById('searchFieldset_currentTable');
        selectElement2.classList.remove("layui-hide");
        var element = document.getElementById('layui-input-search');
        element.parentNode.removeChild(element);
    });
</script>
{/block}